home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / bbs / cddk9606.zip / HEADERS.ARJ / DMENUS.INT < prev    next >
Text File  |  1996-06-14  |  4KB  |  98 lines

  1.  
  2. { ───────────────────────────────────────────────────────────────────────── }
  3. {  DMENUS: A script-based menu system for door games                        }
  4. {  Copyright 1996 David Pinch ∙ All Rights Reserved Worldwide               }
  5. { ───────────────────────────────────────────────────────────────────────── }
  6.  
  7. UNIT DMenus;
  8.  
  9. {$B-} { . . . . . . . . . . . . . . . . . . . . Shortcut boolean evaluation }
  10. {$F+} { . . . . . . . . . . . . . . . . . . . .  Force far calls for safety }
  11. {$I-} { . . . . . . . . . . . . . . . . . . . Disable input/output checking }
  12. {$O+} { . . . . . . . . . . . . . . . . . . Allow this unit to be overlayed }
  13. {$Q-} { . . . . . . . . . . . . . .  Do not generate overflow-checking code }
  14. {$R-} { . . . . . . . . . . . . . . . . Do not generate range-checking code }
  15. {$S-} { . . . . . . . . . . . . . . . . Do not generate stack-checking code }
  16. {$X+} { . . . . . . . . . . . Extended syntax for pChars and function calls }
  17.  
  18. INTERFACE
  19.  
  20. USES
  21.   Objects, Scripts;
  22.  
  23. TYPE
  24.  
  25.   tMenuItem = OBJECT(tObject)
  26.     Id   : Byte;                      { . . . . . . . . . . . . Return code }
  27.     Bar  : pChar;                     { . . . .  Text shown in the lightbar }
  28.     Exec : pChar;                     { . . . . . . . . . Optional commands }
  29.     Key  : pChar;                     { . . . . . . . . . . . . . .  Hotkey }
  30.     Text : pChar;                     { . . . . . . . . . . . . . Help text }
  31.     CONSTRUCTOR Init(i:Byte; b,e,k,t:pChar);
  32.     DESTRUCTOR Done; VIRTUAL;
  33.     END;
  34.  
  35.   pMenuItem = ^tMenuItem;
  36.  
  37.   tMenu = OBJECT(tID)
  38.  
  39.     Columns   : Byte;        { .  Number of columns of the internal display }
  40.     Current   : Byte;        { . . . . . . . . Current item in the lightbar }
  41.     Draw      : pChar;       { . . . . . . . . . . . . . . . Drawing script }
  42.     FileName  : pChar;       { . . . . . . . . . . . . Location of MNU file }
  43.     Format    : pChar;       { . . . . . . . Format of the internal display }
  44.     Internal  : Boolean;     { . . . . . . . . . . . .  Draw internal menu? }
  45.     Items     : pCollection; { . . . . . . . . . . Collection of menu items }
  46.     LightBar  : Boolean;     { . . . . . . . Use the lightbar entry method? }
  47.     Pressed   : Char;        { . . . . . . . . . . . Last character pressed }
  48.     Prompt    : pChar;       { . . . Prompt shown on the bottom of the menu }
  49.     StartAt   : Byte;        { . . . .  Starting point of the lightbar menu }
  50.  
  51.     CONSTRUCTOR Init(Name,Path:pChar);
  52.  
  53.     PROCEDURE AddItem(i:Byte; b,c,k,t:pChar);
  54.  
  55.     PROCEDURE Defaults;                  { . . . . . Assigns default values }
  56.     PROCEDURE DrawMenu;                  { . . . . . . . . . Draws the menu }
  57.     PROCEDURE DrawPrompt;                { . . . . .  Draws the menu prompt }
  58.     PROCEDURE Load;                      { . . . . . . .  Loads an MNU file }
  59.     FUNCTION  Run:Byte;                  { . . . . . . .  Executes the menu }
  60.     PROCEDURE ShiftLightBar(n:ShortInt); { . . . . . .  Shifts the lightbar }
  61.     PROCEDURE Update(b,e,k,t:pChar);     { . . . . .  Updates the last item }
  62.     FUNCTION  Valid:Boolean;             { .  Returns validity of keystroke }
  63.  
  64.     DESTRUCTOR Done; VIRTUAL;
  65.     END;
  66.  
  67.   pMenu = ^tMenu;
  68.  
  69.  
  70. {#Start}
  71.  
  72. PROCEDURE RegisterMenu(Name,PathName:pChar);
  73.   {
  74.   PURPOSE  : Registers a menu with the system.
  75.  
  76.   PARAMS   : Name        A keyword to identify the menu in the future.
  77.                          You must use a unique identifier.
  78.  
  79.              PathName    The name of the menu configuration script, or
  80.                          INTERNAL (not case-sensitive).  The script
  81.                          is immediately processed if a valid path is
  82.                          specified; otherwise, it is assumed that you
  83.                          will create the menu internally.
  84.   }
  85.  
  86.  
  87. FUNCTION RunMenu(Name:pChar):Byte;
  88.   {
  89.   PURPOSE  : Executes a previously loaded menu.
  90.   }
  91.  
  92.  
  93. IMPLEMENTATION
  94.  
  95. { The source code is available upon registration. }
  96.  
  97. END.
  98.